package com.charge.service.impl;

import com.charge.dao.AccountMapping;
import com.charge.domain.Account;
import com.charge.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * Description :
 * Author : 91658
 * Date : 2018/6/7 14:01
 **/
@Service("accountService")
public class AccountServiceImpl implements AccountService {

    @Autowired
    private AccountMapping accountMapping;

    @Override
    public int insertAccount(Account account) {
        account.setCreateTime(new Date());
        return accountMapping.insertSelective(account);
    }

    @Override
    public int deleteAccount(Account account) {
        account.setDelFlag(1);
        return accountMapping.updateByPrimaryKeySelective(account);
    }

    @Override
    public int updateAccount(Account account) {
        return accountMapping.updateByPrimaryKeySelective(account);
    }

    @Override
    public Account selectAccountById(Integer id) {
        return accountMapping.selectByPrimaryKey(id);
    }

    @Override
    public List<Account> selectAccountList(Account account) {
        return accountMapping.selectAll(account);
    }
}
